<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <c:set var="ctx" value="${pageContext.request.contextPath}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>保险公司险种关系表 管理</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<form id="insCompTypR_form">
    <table class="sq-formTable">
        <tbody>
        <tr>
            <td colspan="4" class="caption">
                <div class="inR">保险公司险种关系表 信息</div>
            </td>
        </tr>

        <tr>
            <td class="tbLabel">
                <div class="label">险种名称</div>
            </td>
            <td>
                <div class="field">
                    <input name="insCompId" id="insCompId" type="text" class="ui-textbox"
                           value="${insCompTypRVO.insCompId}" validate="{required:false,number:true}">
                </div>
                <span class="requiredSymbol">*</span>
            </td>
        </tr>
        <tr>
            <td class="tbLabel">
                <div class="label">险种标示</div>
            </td>
            <td>
                <div class="field">
                    <input name="insTypId" id="insTypId" type="text" class="ui-textbox"
                           value="${insCompTypRVO.insTypId}" validate="{required:false,number:true}">
                </div>
                <span class="requiredSymbol">*</span>
            </td>
        </tr>
        <tr>
            <td class="tbLabel">
                <div class="label">险种费率</div>
            </td>
            <td>
                <div class="field">
                    <input name="rate" id="rate" type="text" class="ui-textbox" value="${insCompTypRVO.rate}"
                           validate="{required:false,number:true}">
                </div>
                <span class="requiredSymbol">*</span>
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center">
                <div class="btnsBox">
                    <span id="saveInsCompTypR_Btn" class="sq-button sq-button-hasicon"><i
                            class="sqBtnIco_10"></i>保存</span>
                    <input type="reset" id="resetBtn" class="l-button l-button-reset Hide">
                </div>
            </td>
        </tr>
        </tbody>
    </table>
</form>
<script>
    $(function () {
        var insCompTypRId = "${insCompTypRVO.id}";//主键ID
        $("#insCompTypR_form").ligerForm({
            validate: true
        });
        /*保存险种信息*/
        $("#saveInsCompTypR_Btn").click(function (event) {
            var form = liger.get("insCompTypR_form");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            var data = form.getData();
            $.ligerDialog.hide();
            var _url;
            if (insCompTypRId == '') {//新增
                _url = '<%=path%>/insurance/insCompTypR/add.do';
            } else {//修改
                _url = '<%=path%>/insurance/insCompTypR/modify.do?id=' + insCompTypRId;
            }
            var wait_dialog;
            $.ajax({
                type: 'post',
                dataType: 'json',
                data: data,
                url: _url,
                beforeSend: function () {
                    wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
                },
                success: function (msg) {
                    wait_dialog.close();
                    if (msg.success == 1) {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
                        $("#resetBtn").click();
                        //回调刷新列表
                        var callback = frameElement.W2W.callback;
                        Remove_navTab();
                        callback();
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        });
    });
</script>
</body>
</html>
